﻿VoteModel=new Object();

HackApp.Watch(VoteModel, "voteCount", function (th, prop, oldval, val)
{
  var voteCont = document.getElementById("voteCount");
  voteCont.innerHTML = val;

  return val;
});

function VoteIdea(ideaId)
{
  if (ideaId != null)
  {
    jQuery.ajax("/Idea/VoteRequest/" + ideaId,
    {
      success: function (data, textStatus, jqXHR)
      {
        alert(data.message);
        VoteModel.voteCount = data.data;
      }
    });
  }
  else
  {
    alert("You must specify an idea to vote");
  }
}

